\(\int \csc ^2(c+d x) (a+b \sec (c+d x)) \, dx\) [171]

   Optimal result
   Rubi [A] (verified)
   Mathematica [C] (verified)
   Maple [A] (verified)
   Fricas [A] (verification not implemented)
   Sympy [F]
   Maxima [A] (verification not implemented)
   Giac [B] (verification not implemented)
   Mupad [B] (verification not implemented)

Optimal result

Integrand size = 19, antiderivative size = 37 \[ \int \csc ^2(c+d x) (a+b \sec (c+d x)) \, dx=\frac {b \text {arctanh}(\sin (c+d x))}{d}-\frac {a \cot (c+d x)}{d}-\frac {b \csc (c+d x)}{d} \]

[Out]

b*arctanh(sin(d*x+c))/d-a*cot(d*x+c)/d-b*csc(d*x+c)/d

Rubi [A] (verified)

Time = 0.12 (sec) , antiderivative size = 37, normalized size of antiderivative = 1.00, number of steps used = 7, number of rules used = 7, \(\frac {\text {number of rules}}{\text {integrand size}}\) = 0.368, Rules used = {3957, 2917, 2701, 327, 213, 3852, 8} \[ \int \csc ^2(c+d x) (a+b \sec (c+d x)) \, dx=-\frac {a \cot (c+d x)}{d}+\frac {b \text {arctanh}(\sin (c+d x))}{d}-\frac {b \csc (c+d x)}{d} \]

[In]

Int[Csc[c + d*x]^2*(a + b*Sec[c + d*x]),x]

[Out]

(b*ArcTanh[Sin[c + d*x]])/d - (a*Cot[c + d*x])/d - (b*Csc[c + d*x])/d

Rule 8

Int[a_, x_Symbol] :> Simp[a*x, x] /; FreeQ[a, x]

Rule 213

Int[((a_) + (b_.)*(x_)^2)^(-1), x_Symbol] :> Simp[(-(Rt[-a, 2]*Rt[b, 2])^(-1))*ArcTanh[Rt[b, 2]*(x/Rt[-a, 2])]
, x] /; FreeQ[{a, b}, x] && NegQ[a/b] && (LtQ[a, 0] || GtQ[b, 0])

Rule 327

Int[((c_.)*(x_))^(m_)*((a_) + (b_.)*(x_)^(n_))^(p_), x_Symbol] :> Simp[c^(n - 1)*(c*x)^(m - n + 1)*((a + b*x^n
)^(p + 1)/(b*(m + n*p + 1))), x] - Dist[a*c^n*((m - n + 1)/(b*(m + n*p + 1))), Int[(c*x)^(m - n)*(a + b*x^n)^p
, x], x] /; FreeQ[{a, b, c, p}, x] && IGtQ[n, 0] && GtQ[m, n - 1] && NeQ[m + n*p + 1, 0] && IntBinomialQ[a, b,
 c, n, m, p, x]

Rule 2701

Int[(csc[(e_.) + (f_.)*(x_)]*(a_.))^(m_)*sec[(e_.) + (f_.)*(x_)]^(n_.), x_Symbol] :> Dist[-(f*a^n)^(-1), Subst
[Int[x^(m + n - 1)/(-1 + x^2/a^2)^((n + 1)/2), x], x, a*Csc[e + f*x]], x] /; FreeQ[{a, e, f, m}, x] && Integer
Q[(n + 1)/2] &&  !(IntegerQ[(m + 1)/2] && LtQ[0, m, n])

Rule 2917

Int[(cos[(e_.) + (f_.)*(x_)]*(g_.))^(p_)*((d_.)*sin[(e_.) + (f_.)*(x_)])^(n_.)*((a_) + (b_.)*sin[(e_.) + (f_.)
*(x_)]), x_Symbol] :> Dist[a, Int[(g*Cos[e + f*x])^p*(d*Sin[e + f*x])^n, x], x] + Dist[b/d, Int[(g*Cos[e + f*x
])^p*(d*Sin[e + f*x])^(n + 1), x], x] /; FreeQ[{a, b, d, e, f, g, n, p}, x]

Rule 3852

Int[csc[(c_.) + (d_.)*(x_)]^(n_), x_Symbol] :> Dist[-d^(-1), Subst[Int[ExpandIntegrand[(1 + x^2)^(n/2 - 1), x]
, x], x, Cot[c + d*x]], x] /; FreeQ[{c, d}, x] && IGtQ[n/2, 0]

Rule 3957

Int[(cos[(e_.) + (f_.)*(x_)]*(g_.))^(p_.)*(csc[(e_.) + (f_.)*(x_)]*(b_.) + (a_))^(m_.), x_Symbol] :> Int[(g*Co
s[e + f*x])^p*((b + a*Sin[e + f*x])^m/Sin[e + f*x]^m), x] /; FreeQ[{a, b, e, f, g, p}, x] && IntegerQ[m]

Rubi steps \begin{align*} \text {integral}& = -\int (-b-a \cos (c+d x)) \csc ^2(c+d x) \sec (c+d x) \, dx \\ & = a \int \csc ^2(c+d x) \, dx+b \int \csc ^2(c+d x) \sec (c+d x) \, dx \\ & = -\frac {a \text {Subst}(\int 1 \, dx,x,\cot (c+d x))}{d}-\frac {b \text {Subst}\left (\int \frac {x^2}{-1+x^2} \, dx,x,\csc (c+d x)\right )}{d} \\ & = -\frac {a \cot (c+d x)}{d}-\frac {b \csc (c+d x)}{d}-\frac {b \text {Subst}\left (\int \frac {1}{-1+x^2} \, dx,x,\csc (c+d x)\right )}{d} \\ & = \frac {b \text {arctanh}(\sin (c+d x))}{d}-\frac {a \cot (c+d x)}{d}-\frac {b \csc (c+d x)}{d} \\ \end{align*}

Mathematica [C] (verified)

Result contains higher order function than in optimal. Order 5 vs. order 3 in optimal.

Time = 0.08 (sec) , antiderivative size = 41, normalized size of antiderivative = 1.11 \[ \int \csc ^2(c+d x) (a+b \sec (c+d x)) \, dx=-\frac {a \cot (c+d x)}{d}-\frac {b \csc (c+d x) \operatorname {Hypergeometric2F1}\left (-\frac {1}{2},1,\frac {1}{2},\sin ^2(c+d x)\right )}{d} \]

[In]

Integrate[Csc[c + d*x]^2*(a + b*Sec[c + d*x]),x]

[Out]

-((a*Cot[c + d*x])/d) - (b*Csc[c + d*x]*Hypergeometric2F1[-1/2, 1, 1/2, Sin[c + d*x]^2])/d

Maple [A] (verified)

Time = 1.19 (sec) , antiderivative size = 42, normalized size of antiderivative = 1.14

method result size
derivativedivides \(\frac {-a \cot \left (d x +c \right )+b \left (-\frac {1}{\sin \left (d x +c \right )}+\ln \left (\sec \left (d x +c \right )+\tan \left (d x +c \right )\right )\right )}{d}\) \(42\)
default \(\frac {-a \cot \left (d x +c \right )+b \left (-\frac {1}{\sin \left (d x +c \right )}+\ln \left (\sec \left (d x +c \right )+\tan \left (d x +c \right )\right )\right )}{d}\) \(42\)
parallelrisch \(\frac {-2 b \ln \left (\tan \left (\frac {d x}{2}+\frac {c}{2}\right )-1\right )+2 b \ln \left (\tan \left (\frac {d x}{2}+\frac {c}{2}\right )+1\right )+\left (-a -b \right ) \cot \left (\frac {d x}{2}+\frac {c}{2}\right )+\tan \left (\frac {d x}{2}+\frac {c}{2}\right ) \left (a -b \right )}{2 d}\) \(69\)
risch \(-\frac {2 i \left (b \,{\mathrm e}^{i \left (d x +c \right )}+a \right )}{d \left ({\mathrm e}^{2 i \left (d x +c \right )}-1\right )}-\frac {b \ln \left ({\mathrm e}^{i \left (d x +c \right )}-i\right )}{d}+\frac {b \ln \left ({\mathrm e}^{i \left (d x +c \right )}+i\right )}{d}\) \(71\)
norman \(\frac {-\frac {a +b}{2 d}+\frac {\left (a -b \right ) \tan \left (\frac {d x}{2}+\frac {c}{2}\right )^{2}}{2 d}}{\tan \left (\frac {d x}{2}+\frac {c}{2}\right )}+\frac {b \ln \left (\tan \left (\frac {d x}{2}+\frac {c}{2}\right )+1\right )}{d}-\frac {b \ln \left (\tan \left (\frac {d x}{2}+\frac {c}{2}\right )-1\right )}{d}\) \(79\)

[In]

int(csc(d*x+c)^2*(a+b*sec(d*x+c)),x,method=_RETURNVERBOSE)

[Out]

1/d*(-a*cot(d*x+c)+b*(-1/sin(d*x+c)+ln(sec(d*x+c)+tan(d*x+c))))

Fricas [A] (verification not implemented)

none

Time = 0.28 (sec) , antiderivative size = 63, normalized size of antiderivative = 1.70 \[ \int \csc ^2(c+d x) (a+b \sec (c+d x)) \, dx=\frac {b \log \left (\sin \left (d x + c\right ) + 1\right ) \sin \left (d x + c\right ) - b \log \left (-\sin \left (d x + c\right ) + 1\right ) \sin \left (d x + c\right ) - 2 \, a \cos \left (d x + c\right ) - 2 \, b}{2 \, d \sin \left (d x + c\right )} \]

[In]

integrate(csc(d*x+c)^2*(a+b*sec(d*x+c)),x, algorithm="fricas")

[Out]

1/2*(b*log(sin(d*x + c) + 1)*sin(d*x + c) - b*log(-sin(d*x + c) + 1)*sin(d*x + c) - 2*a*cos(d*x + c) - 2*b)/(d
*sin(d*x + c))

Sympy [F]

\[ \int \csc ^2(c+d x) (a+b \sec (c+d x)) \, dx=\int \left (a + b \sec {\left (c + d x \right )}\right ) \csc ^{2}{\left (c + d x \right )}\, dx \]

[In]

integrate(csc(d*x+c)**2*(a+b*sec(d*x+c)),x)

[Out]

Integral((a + b*sec(c + d*x))*csc(c + d*x)**2, x)

Maxima [A] (verification not implemented)

none

Time = 0.20 (sec) , antiderivative size = 50, normalized size of antiderivative = 1.35 \[ \int \csc ^2(c+d x) (a+b \sec (c+d x)) \, dx=-\frac {b {\left (\frac {2}{\sin \left (d x + c\right )} - \log \left (\sin \left (d x + c\right ) + 1\right ) + \log \left (\sin \left (d x + c\right ) - 1\right )\right )} + \frac {2 \, a}{\tan \left (d x + c\right )}}{2 \, d} \]

[In]

integrate(csc(d*x+c)^2*(a+b*sec(d*x+c)),x, algorithm="maxima")

[Out]

-1/2*(b*(2/sin(d*x + c) - log(sin(d*x + c) + 1) + log(sin(d*x + c) - 1)) + 2*a/tan(d*x + c))/d

Giac [B] (verification not implemented)

Leaf count of result is larger than twice the leaf count of optimal. 77 vs. \(2 (37) = 74\).

Time = 0.30 (sec) , antiderivative size = 77, normalized size of antiderivative = 2.08 \[ \int \csc ^2(c+d x) (a+b \sec (c+d x)) \, dx=\frac {2 \, b \log \left ({\left | \tan \left (\frac {1}{2} \, d x + \frac {1}{2} \, c\right ) + 1 \right |}\right ) - 2 \, b \log \left ({\left | \tan \left (\frac {1}{2} \, d x + \frac {1}{2} \, c\right ) - 1 \right |}\right ) + a \tan \left (\frac {1}{2} \, d x + \frac {1}{2} \, c\right ) - b \tan \left (\frac {1}{2} \, d x + \frac {1}{2} \, c\right ) - \frac {a + b}{\tan \left (\frac {1}{2} \, d x + \frac {1}{2} \, c\right )}}{2 \, d} \]

[In]

integrate(csc(d*x+c)^2*(a+b*sec(d*x+c)),x, algorithm="giac")

[Out]

1/2*(2*b*log(abs(tan(1/2*d*x + 1/2*c) + 1)) - 2*b*log(abs(tan(1/2*d*x + 1/2*c) - 1)) + a*tan(1/2*d*x + 1/2*c)
- b*tan(1/2*d*x + 1/2*c) - (a + b)/tan(1/2*d*x + 1/2*c))/d

Mupad [B] (verification not implemented)

Time = 14.57 (sec) , antiderivative size = 60, normalized size of antiderivative = 1.62 \[ \int \csc ^2(c+d x) (a+b \sec (c+d x)) \, dx=\frac {2\,b\,\mathrm {atanh}\left (\mathrm {tan}\left (\frac {c}{2}+\frac {d\,x}{2}\right )\right )}{d}-\frac {\frac {a}{2}+\frac {b}{2}}{d\,\mathrm {tan}\left (\frac {c}{2}+\frac {d\,x}{2}\right )}+\frac {\mathrm {tan}\left (\frac {c}{2}+\frac {d\,x}{2}\right )\,\left (\frac {a}{2}-\frac {b}{2}\right )}{d} \]

[In]

int((a + b/cos(c + d*x))/sin(c + d*x)^2,x)

[Out]

(2*b*atanh(tan(c/2 + (d*x)/2)))/d - (a/2 + b/2)/(d*tan(c/2 + (d*x)/2)) + (tan(c/2 + (d*x)/2)*(a/2 - b/2))/d